<template>
  <ant-modal
    modalWidth="576"
    modalHeight="500"
    :visible="open"
    :modal-title="formTitle"
    :adjust-size="true"
    @cancel="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="12">
          <a-form-model-item label="规则编码" prop="ruleCode">
            <a-input v-model="form.ruleCode" placeholder="请输入规则编码"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="规则名称" prop="ruleName">
            <a-input v-model="form.ruleName" placeholder="请输入规则名称"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="最大长度" prop="maxLength">
            <a-input-number v-model="form.maxLength" :min="0" style="width: 100%"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="是否补齐" prop="isPadded">
            <a-radio-group v-model="form.isPadded" button-style="solid">
              <a-radio-button
                v-for="(dict, index) in isPaddedOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="补齐字符" prop="paddedChar">
            <a-input v-model="form.paddedChar" placeholder="请输入补齐字符"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="补齐方式" prop="paddedMethod">
            <a-radio-group v-model="form.paddedMethod">
              <a-radio
                v-for="(dict, index) in paddedMethodOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="32">
        <a-col :span="12" >
          <a-form-model-item label="是否启用" prop="enableFlag">
            <a-radio-group v-model="form.enableFlag" button-style="solid">
              <a-radio-button
                v-for="(dict, index) in enableFlagOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio-button>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="描述" prop="ruleDesc">
            <a-textarea v-model="form.ruleDesc" placeholder="请输入描述" :rows="4"/>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel">
        取消
      </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
        保存
      </a-button>
    </template>
  </ant-modal>
</template>
<script>
import SysAutoCodeRuleAddForm from './SysAutoCodeRuleForm'
export default {
  ...SysAutoCodeRuleAddForm
}
</script>
